package com.haiheng.library_base.activity

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.WindowManager

class TransparentActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        // Set the activity's theme to a translucent no title bar theme
        setTheme(android.R.style.Theme_Translucent_NoTitleBar)

        // Make sure the activity can't get focus
        window.setFlags(
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
            WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
        )
    }

    override fun onAttachedToWindow() {
        super.onAttachedToWindow()
        // Once the activity is attached to the window, immediately give focus back to the main activity
//        val intent = Intent(this, MainActivity::class.java)
//        intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
//        startActivity(intent)
        finish()
    }
}